package com.aaa.hospital.controller;

import com.aaa.hospital.aop.Log;
import com.aaa.hospital.pojo.query.NewsStateQuery;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.NewsStateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program:qy888
 * @description:www
 * @author:LJW
 * @version: 1.0
 * @create:2022-02-23 10:37
 */
@RestController
@RequestMapping("state")
public class NewsStateController {

    @Autowired
    private NewsStateService newsStateService;


    @RequestMapping("query")
    public AjaxResult query(NewsStateQuery newsStateQuery){
        return newsStateService.queryNewsState(newsStateQuery);
    }

    @RequestMapping("upper/{id}")
    @Log("上架新闻")
    public AjaxResult upper(@PathVariable("id")Integer id){
        return newsStateService.upper(id);
    }

    @RequestMapping("lower/{id}")
    @Log("下架新闻")
    public AjaxResult lower(@PathVariable("id")Integer id){
        return newsStateService.lower(id);
    }

    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id") Integer id){
        return newsStateService.get(id);
    }


}
